import React, { Component, lazy, Suspense } from 'react';

// import AllGoods from './Index/AllGoods';
// import Mine from './Index/Mine';
// import Cart from './Index/Cart';
// import Classification from './Index/Classification';
// import Home from './Index/Home';
// import NotFound from './NotFound';

// import Tabbar from '../components/index/Tabbar';
import MyTabbar from '../components/index/MyTabbar';
import { Switch, Route, Redirect } from "react-router-dom"

var AllGoods = lazy(() => import('./Index/AllGoods'))
var Mine = lazy(() => import('./Index/Mine'))
var Cart = lazy(() => import('./Index/Cart'))
var Classification = lazy(() => import('./Index/Classification'))
var Home = lazy(() => import('./Index/Home'))
var NotFound = lazy(() => import('./NotFound'))

class Index extends Component {
    render() {
        return (
            <div>
                <Suspense>
                    <Switch>
                        <Route exact path="/index/home" component={Home} />
                        <Route exact path="/index/cart" component={Cart} />
                        <Route exact path="/index/allgoods" component={AllGoods} />
                        <Route exact path="/index/classification" component={Classification} />
                        <Route exact path="/index/mine" component={Mine} />
                        <Redirect exact from='/index' to="/index/home" />
                        <Route path="*" component={NotFound} />
                    </Switch>
                </Suspense>


                {/* <Tabbar></Tabbar> */}
                <MyTabbar></MyTabbar>

            </div>
        );
    }
}

export default Index;